import Vue from 'vue'
import Router from 'vue-router'
import Main from 'pages/Main'
import home from 'pages/home/home'
import car from 'pages/car/index'
import addCar from 'pages/car/addCar'
import carOrder from 'pages/carOrder/index'
import carOrderSearch from 'pages/carOrderSearch/index'
import carOrderList from 'pages/carOrderSearch/list'
import carOrderDetail from 'pages/carOrder/detail'
import watermark from '@/utils/waterMark.js'

// 维修预约
import applyRepair from 'pages/applyRepair/index'
import applyRepairDetail from 'pages/applyRepair/detail'
import applyRepairCancel from 'pages/applyRepair/cancel'
import applyRepairEdit from 'pages/applyRepair/edit'

import fileMange from 'pages/fileMange/index'
// 维修工单
import repairOrder from 'pages/repairOrder/index'
import repairOrderDetail from 'pages/repairOrder/detail'

// 任务中心
import taskCenter from 'pages/taskCenter/index'
import taskCenterDetail from 'pages/taskCenter/detail'
import taskCenterEdit from 'pages/taskCenter/edit'

// 保单机器人
import policyRobot from 'pages/policyRobot/index'
import policyRobotRecord from 'pages/policyRobot/record'
import policyRobotDetail from 'pages/policyRobot/detail'

// 登记单
import registerList from 'pages/registerList/index'
import registerEdit from 'pages/registerList/edit'
import registerDetail from 'pages/registerList/detail'
import registerFail from 'pages/registerList/fail'
import registerHeat from 'pages/registerList/heat'

// 新登记单
import registerListV2 from '@/pagesV2/registerList/index'
import configSetting from '@/pagesV2/configSetting/index'
import draftList from '@/pagesV2/draft/List'
import quickEdit from '@/pagesV2/registerList/quickEdit'
import registerEditV2 from '@/pagesV2/registerList/edit'
// import registerDetailV2 from 'pagesV2/registerList/detail'
// import registerFailV2 from 'pagesV2/registerList/fail'
import pcHome from 'pages/pcHome/index'

import taskData from 'pages/taskData/index'
import taskMenuNav from 'pages/taskData/menuNav'
import userFollowData from 'pages/taskData/userFollowData'

// 知识库
import knowledgeBase from 'pages/knowledgeBase/index'
import knowledgeBaseDetail from 'pages/knowledgeBase/detail'

// 会员查询
import vipInfo from 'pages/vipInfo/index'
import vipInfoDetail from 'pages/vipInfo/detail'

// 绑车记录
import bindCarIndex from 'pages/vipInfo/bindCar/index'
import bindCarDetail from 'pages/vipInfo/bindCar/detail'

// 客户群
import custGroup from 'pages/custGroup/index'
import custGroupDetail from 'pages/custGroup/detail'


//坐席信息
import seatInformation from 'pages/aicc/seatInformation/info'
import seatPhone from 'pages/aicc/seatInformation/phone' //号码绑定
//通话记录
import callLog from 'pages/aicc/callLog/callLog'
import callDetail from 'pages/aicc/callLog/detail' //通话详情
//语言转写
import asr from 'pages/aicc/asr/asr'
//拨号
import callPhone from 'pages/aicc/callPhone/callPhone'

import incomingCall from 'pages/aicc/callPhone/incomingCall'
import outBoundSeatsCount from 'pages/taskData/outBoundSeatsCount.vue'
import outBoundSeatsCountByOrg from 'pages/taskData/outBoundSeatsCountByOrg.vue'
import pcTaskCenter from 'pages/pcTaskCenter/index'
import vueChat from 'pages/aiChat/vue-chat.vue'


Vue.use(Router)
// const basePath = process.env.basePath
// console.info('base:',basePath)

const router = new Router({
  linkActiveClass: 'cur',
  mode: 'history',
  // base: basePath,
  base: 'bkt',
  routes: [
    {
      path: '/',
      //name: 'Main',
      component: Main,
      children: [
        {
          path: '',
          name: 'Main',
          component: home,
          meta: {
            title: '保客通-客户招揽平台',
          },
        },
        {
          path: '/home',
          name: 'home',
          component: home,
          meta: {
            title: '保客通-客户招揽平台',
            keepAlive: true,
          },
        },
      ],
    },
    {
      path: '/registerList',
      name: 'registerList',
      component: registerList,
      meta: {
        title: '外服登记单',
        keepAlive: true,
      },
    },
    {
      path: '/registerListV2',
      name: 'registerListV2',
      component: registerListV2,
      meta: {
        title: '现场服务登记',
        watermark: true,
      },
    },
    {
      path: '/registerDetail',
      name: 'registerDetail',
      component: registerDetail,
      meta: {
        title: '跟踪单详情',
        watermark: true,
      },
    },
    {
      path: '/registerEditV2',
      name: 'registerEditV2',
      component: registerEditV2,
      meta: {
        title: '现场服务登记',
        watermark: true,
      },
    },
    {
      path: '/registerEdit',
      name: 'registerEdit',
      component: registerEdit,
      meta: {
        title: '新增跟踪单',
        watermark: true,
      },
    },
    {
      path: '/registerFail',
      name: 'registerFail',
      component: registerFail,
      meta: {
        title: '战败登记',
        watermark: true,
      },
    },
    {
      path: '/registerHeat',
      name: 'registerHeat',
      component: registerHeat,
      meta: {
        title: '热力图',
        watermark: true,
      },
    },
    {
      path: '/car',
      name: 'car',
      component: car,
      meta: {
        title: '车辆选择',
        watermark: true,
        // keepAlive:true
      },
    },
    {
      path: '/addCar',
      name: 'addCar',
      component: addCar,
      meta: {
        title: '新增车辆',
        watermark: true,
      },
    },
    {
      path: '/fileMange',
      name: 'fileMange',
      component: fileMange,
      meta: {
        title: '附件管理',
        watermark: true,
      },
    },
    {
      path: '/configSetting',
      name: 'configSetting',
      component: configSetting,
      meta: {
        title: '设置',
        watermark: true,
      },
    },
    {
      path: '/draftList',
      name: 'draftList',
      component: draftList,
      meta: {
        title: '草稿箱',
        watermark: true,
      },
    },
    {
      path: '/quickEdit',
      name: 'quickEdit',
      component: quickEdit,
      meta: {
        title: '事故服务登记',
        watermark: true,
      },
    },
    {
      path: '/carOrder',
      name: 'carOrder',
      component: carOrder,
      meta: {
        title: '车辆档案',
        keepAlive: true,
        watermark: true,
      },
    },
    {
      path: '/carOrderSearch',
      name: 'carOrderSearch',
      component: carOrderSearch,
      meta: {
        title: '车辆查询',
        keepAlive: true,
        watermark: true,
      },
    },
    {
      path: '/carOrderList',
      name: 'carOrderList',
      component: carOrderList,
      meta: {
        title: '车辆查询',
        keepAlive: true,
        watermark: true,
      },
    },
    {
      path: '/carOrderDetail',
      name: 'carOrderDetail',
      component: carOrderDetail,
      meta: {
        title: '车辆详情',
      },
    },
    {
      path: '/applyRepair',
      name: 'applyRepair',
      component: applyRepair,
      meta: {
        title: '维修预约',
        keepAlive: true,
        watermark: true,
      },
    },
    {
      path: '/applyRepairEdit',
      name: 'applyRepairEdit',
      component: applyRepairEdit,
      meta: {
        title: '新建预约单',
        watermark: true,
      },
    },
    {
      path: '/applyRepairDetail',
      name: 'applyRepairDetail',
      component: applyRepairDetail,
      meta: {
        title: '预约单详情',
        watermark: true,
      },
    },
    {
      path: '/applyRepairCancel',
      name: 'applyRepairCancel',
      component: applyRepairCancel,
      meta: {
        title: '预约单取消',
        watermark: true,
      },
    },

    {
      path: '/repairOrder',
      name: 'repairOrder',
      component: repairOrder,
      meta: {
        title: '维修工单',
        keepAlive: true,
        watermark: true,
      },
    },
    {
      path: '/repairOrderDetail',
      name: 'repairOrderDetail',
      component: repairOrderDetail,
      meta: {
        title: '维修工单详情',
        watermark: true,
      },
    },
    {
      path: '/taskCenter',
      name: 'taskCenter',
      component: taskCenter,
      meta: {
        title: '任务中心',
        keepAlive: true,
        watermark: true,
      },
    },
    {
      path: '/taskCenterDetail',
      name: 'taskCenterDetail',
      component: taskCenterDetail,
      meta: {
        title: '任务详情',
        watermark: true,
      },
    },
    {
      path: '/taskCenterEdit',
      name: 'taskCenterEdit',
      component: taskCenterEdit,
      meta: {
        title: '跟进信息录入',
        watermark: true,
      },
    },
    {
      path: '/policyRobot',
      name: 'policyRobot',
      component: policyRobot,
      meta: {
        title: '保单机器人',
        watermark: true,
      },
    },
    {
      path: '/policyRobotDetail',
      name: 'policyRobotDetail',
      component: policyRobotDetail,
      meta: {
        title: '保险登记单',
        watermark: true,
      },
    },

    {
      path: '/policyRobotRecord',
      name: 'policyRobotRecord',
      component: policyRobotRecord,
      meta: {
        title: '上传记录',
        keepAlive: true,
        watermark: true,
      },
    },
    {
      path: '/pcHome',
      name: 'pcHome',
      component: pcHome,
      meta: {
        title: '保客通',
        watermark: true,
        keepAlive: true,
      },
    },
    {
      path: '/taskData',
      name: 'taskData',
      component: taskData,
      meta: {
        title: '任务数据统计',
        watermark: true,
      },
    },
    {
      path: '/taskMenuNav',
      name: 'taskMenuNav',
      component: taskMenuNav,
      meta: {
        title: '任务数据统计',
        watermark: true,
      },
    },
    {
      path: '/userFollowData',
      name: 'userFollowData',
      component: userFollowData,
      meta: {
        title: '人员跟进情况表',
        watermark: true,
      },
    },
    {
      path: '/knowledgeBase',
      name: 'knowledgeBase',
      component: knowledgeBase,
      meta: {
        title: '知识库',
        watermark: true,
      },
    },
    {
      path: '/knowledgeBaseDetail',
      name: 'knowledgeBaseDetail',
      component: knowledgeBaseDetail,
      meta: {
        title: '知识库',
        watermark: true,
      },
    },
    {
      path: '/vipInfo',
      name: 'vipInfo',
      component: vipInfo,
      meta: {
        title: '会员信息查询',
        watermark: true,
      },
    },
    {
      path: '/vipInfoDetail',
      name: 'vipInfoDetail',
      component: vipInfoDetail,
      meta: {
        title: '会员信息',
        watermark: true,
      },
    },
    {
      path: '/bindCarIndex',
      name: 'bindCarIndex',
      component: bindCarIndex,
      meta: {
        title: '绑车记录查询',
        watermark: true,
      },
    },
    {
      path: '/bindCarDetail',
      name: 'bindCarDetail',
      component: bindCarDetail,
      meta: {
        title: '绑车记录',
        watermark: true,
      },
    },
    {
      path: '/custGroup',
      name: 'custGroup',
      component: custGroup,
      meta: {
        title: '客户群查询',
        watermark: true,
      },
    },
    {
      path: '/custGroupDetail',
      name: 'custGroupDetail',
      component: custGroupDetail,
      meta: {
        title: '客户群信息',
        watermark: true,
      },
    },
    {
      path: '/seatInformation',
      name: 'seatInformation',
      component: seatInformation,
      meta: {
        title: '座席信息',
      },
    },
    {
      path: '/seatPhone',
      name: 'seatPhone',
      component: seatPhone,
      meta: {
        title: '号码绑定',
      },
    },
    {
      path: '/callLog',
      name: 'callLog',
      component: callLog,
      meta: {
        title: '通话记录',
        keepAlive: true,
      },
    },
    {
      path: '/callDetail',
      name: 'callDetail',
      component: callDetail,
      meta: {
        title: '通话详情',
      },
    },
    {
      path: '/asr',
      name: 'asr',
      component: asr,
      meta: {
        title: '转写记录',
      },
    },
    {
      path: '/callPhone',
      name: 'callPhone',
      component: callPhone,
      meta: {
        title: '',
      },
    },
    {
      path: '/incomingCall',
      name: 'incomingCall',
      component: incomingCall,
      meta: {
        title: '来电提醒',
        watermark: true,
      },
    },
    {
      path: '/outBoundSeatsCount',
      name: 'outBoundSeatsCount',
      component: outBoundSeatsCount,
      meta: {
        title: '座席统计_人员',
        watermark: true,
      },
    },
    {
      path: '/outBoundSeatsCountByOrg',
      name: 'outBoundSeatsCountByOrg',
      component: outBoundSeatsCountByOrg,
      meta: {
        title: '座席统计_门店',
        watermark: true,
      },
    },
    {
      path: '/pcTaskCenter',
      name: 'pcTaskCenter',
      component: pcTaskCenter,
      meta: {
        title: '保客通',
        watermark: true,
        keepAlive: true,
      },
    },
    {
      path: '/vueChat',
      name: 'vueChat',
      component: vueChat,
      meta: {
        title: '保客通',
        watermark: true,
        keepAlive: false,
      },
    },
  ],
})

router.beforeEach((to, from, next) => {
  watermark.remove()
  next()
})
router.afterEach((to, from) => {
  if(to.meta.watermark) {
    watermark.add()
  }
})

export default router
